import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import store from "./store";
import 'element-ui/lib/theme-chalk/index.css';
import VueQuillEditor from 'vue-quill-editor'
// require styles 引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import axios from "axios";

import qs from "qs";

Vue.prototype.$qs = qs

// 设置全局的axios
Vue.prototype.$axios=axios
Vue.prototype.$examUrl = 'http://localhost:8090/#/dashboard?t=';
// 设置基本路径
axios.defaults.baseURL='http://localhost:8081/'
axios.defaults.withCredentials = true

Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(VueQuillEditor)
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
axios.interceptors.request.use(config => {
  let token = window.localStorage.getItem('ddToken')
  if (token) {  // 判断是否存在token，如果存在的话，则每个http header都加上token
    config.headers.authorization = token
  }
  return config
}, error => {
  return Promise.reject(error)
})
